# -*- coding: utf-8 -*-
"""
Created on Sun Apr 18 21:46:14 2021

@author: xiong
"""

tubanPath = r'C:\Users\xiong\Documents\WeChat Files\wxid_gszrrav1c5oh11\FileStorage\File\2021-04\32\32.shp'

huh = r'C:\Users\xiong\Documents\WeChat Files\wxid_gszrrav1c5oh11\FileStorage\File\2021-04\32'
cntr = 0
rowList = []
with arcpy.da.UpdateCursor(tubanPath,('FID',"Shape@",'type','name','value')) as cursor:
    for row in cursor:
        rowList.append(row)
        cursor.deleteRow()
for i in rowList:
    cntr += 1
    with arcpy.da.InsertCursor(tubanPath,('FID',"Shape@",'type','name','value'))as insyoubiao:
        insyoubiao.insertRow(i)
        
        
    arcpy.MultipartToSinglepart_management(tubanPath,huh + '\\' + str(cntr)+'.shp')
    cout6 = 0
    
    with arcpy.da.UpdateCursor(huh + '\\' + str(cntr)+'.shp',('type')) as cursor:
        for row in cursor:
            cout6 += 1
            
            
    print(str(i[-1]) + ':' + str(cout6) + '个图斑')
    
    with arcpy.da.UpdateCursor(tubanPath,('FID',"Shape@",'type','name','value')) as cursor:
        for row in cursor:
            cursor.deleteRow()
